import time

from selenium.webdriver.common.by import By
from yuekao.Base.Base import Base
class Page2(Base):

    # 搜索框
    search_loc=(By.ID,'chat-textarea')
    # 点击搜索
    searchbtn_loc=(By.ID,'chat-submit-button')
    # 第二页
    two_loc=(By.CLASS_NAME,'page-item_M4MDr pc')

    dy_loc=(By.XPATH,'//*[@id="s_tab_inner"]/b')

    def search(self):
        self.send_keys(self.search_loc,'我喜欢软件测试')

    def searchbtn(self):
        self.click(self.searchbtn_loc)

    def two(self):
        self.click(self.two_loc)

    def dy(self):
        return self.text(self.dy_loc)

    def luoji3(self):
        self.open_url('https://www.baidu.com')
        print('self.search()')
        assert '我喜欢软件测试' == self.search()
        self.searchbtn()
        self.two()
        print(self.dy())
        assert '网页' ==self.dy()
        # 强制等待
        time.sleep(2)
